#ifndef MYOPENGLWIDGET_H
#define MYOPENGLWIDGET_H
#include <QTimer>
#include <QOpenGLWidget>
#include<QDebug>
#include <QOpenGLFunctions_3_3_Core>
#include<QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include<QImage>
#include<QKeyEvent>
class MyOpenglWidget : public QOpenGLWidget,QOpenGLFunctions_3_3_Core
{
    Q_OBJECT
public:
    explicit MyOpenglWidget(QWidget* parent = nullptr);
    ~MyOpenglWidget();
    void drawRectangle();
    void clear();
    void setPolygonMode(bool isWire);

protected:
    virtual void initializeGL();
    virtual void resizeGL(int w, int h);
    virtual void paintGL();

private:
    bool isDraw=false;
    int ShapeType=GL_TRIANGLES;
    QOpenGLShaderProgram shaderProgram;
    QOpenGLShaderProgram lightingShaderProgram;

    QOpenGLTexture* textureWall;
    QOpenGLTexture* textureContainer;
    QTimer timer;

    // QWidget interface
protected:
    void keyPressEvent(QKeyEvent *event);
    void mouseMoveEvent(QMouseEvent *event);
    void wheelEvent(QWheelEvent *event);
};

#endif // MYOPENGLWIDGET_H
